home *** CD-ROM | disk | FTP | other *** search
- #ifndef __C3DView__
- #define __C3DView__
- #define __C3DVIEW__
-
- //------------------------------------------------------------------------------
- // Constants and enums
- //------------------------------------------------------------------------------
-
- // NOTE: If you add another "Depressed" state to the 3DState enum (and
- // consequently the fColor array), be sure to add it AFTER rstDepressed.
- // If you add another NON-Depressed state, add it BEFORE rstDepressed
- // and slide all the other numbers up one. This is to allow subclasses
- // to easily detect whether the "button" is "depressed" or not, since
- // they might want to act slightly differently (like drawing overlayed
- // a little down and to the right, to make the button look like it
- // actually gets pressed down).
-
- const short kDefaultNumberOf3DViewStates = 5;
- const short kDefaultNumberOf3DViewParts = 6;
-
- extern const Boolean kIsDeep;
- extern const Boolean kIsNotDeep;
-
- extern const Boolean kIsDepressed;
- extern const Boolean kIsNotDepressed;
-
- typedef enum
- {
- // NON-Depressed states:
- rstNominal = 0, // the "button" is up/off/normal/un-pressed
- rstRed = 1, // usually used for "record" modes, warnings, etc
- rstGreen = 2, // usually used for optional modes
- // Depressed states:
- rstDepressed = 3, // the "button" is down/on (NOT an emotional state!)
- rstDepressedWhite = 4 // for "buttons" that light up white when pressed
- } E3DState;
-
- typedef enum
- {
- rptOutsideUpperLeft = 0,
- rptInsideUpperLeft = 1,
- rptFill = 2,
- rptInsideLowerRight = 3,
- rptMiddleLowerRight = 4,
- rptOutsideLowerRight = 5
- } E3DPart;
-
-
- //------------------------------------------------------------------------------
- // Class definition
- //------------------------------------------------------------------------------
-
- class C3DView
- {
-
- // Initialization and cleanup
- public:
- C3DView(E3DState itsInitialState = rstNominal);
-
- // Drawing
- public:
- virtual void Draw3D(const DrawContext * context);
-
- virtual void DrawWithDepth(const DrawContext * context);
- virtual void DrawWithoutDepth(const DrawContext * context);
-
- virtual void Invalidate(const DrawContext * context);
-
- protected:
- virtual short CheckScreenDepth(const DrawContext * context);
-
- // Access
- public:
- virtual E3DState GetState();
- virtual void SetState(const DrawContext * context, E3DState theState, Boolean redraw);
-
- virtual Boolean IsDepressed();
-
- // The following is a rough legend to the different parts
- // that are being drawn for a typical C3DView
- //
- // ------------------------- - OutsideUpperLeft
- // -+++++++++++++++++++++++@ + InsideUpperLeft
- // -+********************$%@
- // -+********************$%@ * Fill
- // -+********************$%@
- // -+$$$$$$$$$$$$$$$$$$$$$%@ $ InsideLowerRight
- // -+%%%%%%%%%%%%%%%%%%%%%%@ % MiddleLowerRight
- // -@@@@@@@@@@@@@@@@@@@@@@@@ @ OutsideLowerRight
-
- // Override these methods to change the default drawing behavior.
- protected:
- virtual void GetOutsideUpperLeftColor(RGBColor * returnColor);
- virtual void GetInsideUpperLeftColor(RGBColor * returnColor);
-
- virtual void GetFillColor(RGBColor * returnColor);
-
- virtual void GetInsideLowerRightColor(RGBColor * returnColor);
- virtual void GetMiddleLowerRightColor(RGBColor * returnColor);
- virtual void GetOutsideLowerRightColor(RGBColor * returnColor);
-
- // Class variables
- public:
- static RGBColor gColor [ kDefaultNumberOf3DViewStates ] [ kDefaultNumberOf3DViewParts ];
- // this static array is used to
- // get colors for all C3DView
- // instances, unless a subclass has
- // overidden the default drawing
- // behavior and bypassed it.
-
- // Instance variables
- protected:
- E3DState mState; // the state of the view
- Boolean mIsDeep; // bit depth, or not?
- Boolean mIsDepressed; // is the "button" pressed down?
-
- };
-
- //----------------------------------------------------------------------------------------
- // Global initialization procedure
- //----------------------------------------------------------------------------------------
-
- extern void InitU3DView(void);
- // Call this routine at initialization time
-
- #endif __C3DView__
-